package cn.lcl.util;

import org.apache.commons.dbutils.ResultSetHandler;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Objects;

/**
 * 查询接口
 * Created by licho on 2017/8/15 0015.
 */
public interface Query {
    /**
     * 插入语句，返回自动生成的键值。
     * @param sql
     * @param params
     * @return
     */
    public Long insert(String sql,boolean isOracle,Object... params) throws SQLException;
    public <T> T query(String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException;
    public <T> T query(String sql, ResultSetHandler<T> rsh) throws SQLException;
    public int update(String sql) throws SQLException;
    public int update(String sql, Object param) throws SQLException;
    public int update(String sql, Object... params) throws SQLException;
    public <T> T insert(String sql, ResultSetHandler<T> rsh) throws SQLException;
    public <T> T insert(String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException;
    public <T> T insertBatch(String sql, ResultSetHandler<T> rsh, Object[][] params) throws SQLException;
    public int execute(String sql, Object... params) throws SQLException;
    public <T> List<T> execute(String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException;
    public int[] batch(String sql, Object[][] params) throws SQLException;
}
